<!DOCTYPE html>
<html>
	<head> 
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>个人信息</title>
		<link rel="stylesheet" href="__TMPL__Public/css/normalize.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/main.css?v1" />
		<link rel="stylesheet" href="__TMPL__Public/css/style.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/ui.css" />
		<style type="text/css">
			.linebg{margin-bottom: 6px;}
		</style>
		<script type="text/javascript">
			function imgerror(obj){
				obj.src = "/themes/simplebootx_mobile/Public/img/user/defaulthead.png";
			}
		</script>
	</head>
	<body>
		<!--<div class="header">
			<a onclick="goBack()" class="left-arrow"><img src="__TMPL__Public/img/arrow-b.png"></a>
			个人信息
			<a class="rightbtn" ><button onclick="submitform()">保存</button></a>
		</div>-->
		
		<form id="userinfo" action="userinfo_edit_post" method="post">
			<input name="user_uniq_id" value="{$user['user_uniq_id']}" type="hidden"/>
		<div class="linebg">
			<a class="line-i ebb">
				<span class="line-before">头像</span>
				<span class="line-arrow">
					<label class="forhead" for="userhead" >
						<img width="32" height="32" id="usericon" class="header" src="{$user.icon}" onerror="imgerror(this)"/>
						<!--<img width="32" height="32" id="usericon" class="uping header" src="__TMPL__Public/img/loading.gif" onerror="imgerror(this)"/>-->
						<!--<img class="header" src="__TMPL__Public/img/user/defaulthead.png"/>-->
					</label>
					<img src="__TMPL__Public/img/user/arrow-r.png"/>
					<input onchange="uphead()" style="display: none;" type="file" id="userhead" name="file" accept="image/*"/>
					<input id="icon" name="icon" type="hidden" value="{$user.icon}">
				</span>
			</a>
			<a class="line-i ebb">
				<span class="line-before">名字</span>
				<span class="line-after"><input id="nick" name="nick" value="{$user.nick}"></span>
				<!--<span class="line-arrow">
					<button type="button" class="prim-bg">确定</button>
				</span>-->
			</a>
			<a class="line-i ebb">
				<span class="line-before">互动号</span>
				<span id="hudong" class="line-after input">{$user.user_uniq_id}</span>
				<span class="line-arrow"><span class="status light-f">已绑定</span></span>
			</a>
			<if condition="$hidead neq 1">
			<a href="/HUser/exchange" class="line-i">
				<span class="line-before">等级</span>
				<span class="line-arrow"><span class="warn-f">{$grade}
					</span><img src="__TMPL__Public/img/user/arrow-r.png"/></span>
			</a>
			</if>
		</div>
		<div class="linebg">
			<a class="line-i ebb">
				<span class="line-before">手机号</span>
				<span class="line-after input"></span>
				<span class="line-arrow"><span name="" class="status light-f">已绑定</span></span>
			</a>
			<a class="line-i ebb">
				<span class="line-before">Q Q</span>
				<span class="line-after">
					<if condition="empty($user['qq'])">
						<input name="qq" class="len" placeholder="请输入准确的qq号 绑定后不可修改哟">
						<else/>
						<input value="{$user['qq']}" name="qq" readonly="readonly" class="len">
					</if>
				</span>
			</a>
			<a class="line-i ebb">
				<span class="line-before">微信</span>
				<span class="line-after">
					<if condition="empty($user['wechat'])">
						<input  name="wechat" class="len" placeholder="请输入准确的微信号 绑定后不可修改哟">
						<else/>
						<input value="{$user['wechat']}" name="wechat" readonly="readonly" class="len">
					</if>
				</span>
			</a>
			<a class="line-i ebb">
				<span class="line-before">邮箱</span>
				<span class="line-after">
					<if condition="empty($user['email'])">
						<input  name="email" class="len" placeholder="请输入准确的邮箱 绑定后不可修改哟">
						<else/>
						<input value="{$user['email']}" name="email" readonly="readonly" class="len">
					</if>
				</span>
			</a>
		</div>
		<div class="linebg">
			<a href="javascript:void(0)" class="line-i ebb" onclick="s_sex()">
				<span class="line-before">性别</span>
				<span class="line-after input" id="gender"></span>
				<span class="line-arrow"><img src="__TMPL__Public/img/user/arrow-r.png"/></span>
			</a>
			<a class="line-i ebb">
				<span class="line-before">签名</span>
				<span class="line-after">
					<textarea maxlength="100" style="width: 70%; vertical-align: top; resize: none;" class="len" name="signature">{$user['signature']}</textarea>
				</span>
			</a>
		</div>
		<div class="footerbody"></div>
		<div id="tip" class="dialog">
			<div class="dialogbg">
				<div class="dlg-close"><img src="__TMPL__Public/img/close.png"></div>
				<div class="dlg-title">选择性别</div>
				<div class="dlg-content">
					<label class="ui-checkbox-s bb">
						<span>男</span>
					    <input id="male" type="radio" name="sex" value="1" onclick="setsex(this)">
					</label>
					<label class="ui-checkbox-s bb">
						<span>女</span>
					    <input id="female" type="radio" name="sex" value="2" onclick="setsex(this)">
					</label>
					<label class="ui-checkbox-s">
						<span>保密</span>
					    <input id="secure" type="radio" name="sex" value="3" onclick="setsex(this)">
					</label>
				</div>
				<button type="button" class="dlg-btn">确 定</button>
			</div>
		</div>
		</form>
	</body>
	<script src="__TMPL__Public/js/jquery-1.8.0.min.js"></script>
	<script src="__TMPL__Public/js/ajaxfileupload.js"></script>
	<script src="__TMPL__Public/js/main.js?{$version}"></script>
	<script type="text/javascript">
		var sex = new dialog();
		var userpost = "{$userpost}";
		var gender = $("#gender");
		if(userpost=="1")alert("修改失败");
		sex.init("tip",confrsex);
		function s_sex(){
			sex.show();
		}
		var userinfo = $("#userinfo");
		function submitform(){
			if(usercheck()){
				userinfo.submit();
			}
			
		}
		(function(){
			var sex = "{$user.sex}";
			switch(sex){
				case "1":$("#male").attr("checked","checked");gender.text("男");
					break;
				case "2":$("#female").attr("checked","checked");gender.text("女");
					break;
				default:$("#secure").attr("checked","checked");gender.text("保密");
					break;
			}
		})();
		var gendertxt = "";
		function setsex(obj){
			switch(obj.value){
				case "1":gendertxt="男";
				break;
				case "2":gendertxt="女";
				break;
				default:gendertxt="保密";
				break;
			}
		}
		function confrsex(){
			gender.text(gendertxt);
		}
		var nick = $("#nick");
		function usercheck(){
			if(nick.val().length==0){
				alert("请输入名字");
				return false;
			}
			if($("#hudong").text().length==0){
				alert("互动号不正确");
				return false;
			}
			return true;
		}
	</script>
	<script type="text/javascript">
	var userheader = $(".header");
		function uphead(){
			userheader.addClass("uping");
			userheader.attr("src","/themes/simplebootx_mobile/Public/img/loading.gif");
			$.ajaxFileUpload({
	            url:'/api/AppGroup/image_upload/',//处理图片脚本
	            secureuri :false,
	            fileElementId :'userhead',//file控件id
	            dataType : 'content',
	            success:function (data, status){
			        var dt = ajaxStrToObj(data);
			        $("#usericon").attr("src",dt.data);
			        $("#icon").val(dt.data);
			        setTimeout(function(){
			        	userheader.removeClass("uping");	
			        },500);
			        
	            },
	            error:function(data, status, e){
	                console.log(e);
	                userheader.attr("src","/themes/simplebootx_mobile/Public/img/defaulthead.png");
	                userheader.removeClass("uping");
	            }
	    	});
		}
	</script>
</html>
